/*
Copyright Brian Dawn 2008.
Notes
 -Uses singleton design.
*/
#ifndef shaderMANAGER_H
#define shaderMANAGER_H
#include <GL/glew.h>
#include <IL/il.h> //devIL library for image loading.
#include <GL/glut.h>
#include <vector>
#include <iostream>
#include <string>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>

#include "glsl.h" //GLSL lib not written by me but http://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/loading.php


struct shadeStruct
{
	std::string id;
	cwc::glShader* shader;
	//std::vector<shaderVariable> variablePair;
};

class shaderManager
{
protected:
	std::vector<shadeStruct*> shader;
	cwc::glShaderManager shaderMngr;
	
	shaderManager();
	shaderManager(const shaderManager&);
	shaderManager& operator =(const shaderManager&);
private:
	static shaderManager* pinstance;
public:
	bool startShader(std::string id);
	bool stopShader(std::string id);

	bool setFloat(std::string id, std::string variable, GLfloat value);
	bool setInt(std::string id, std::string variable, GLint value);

	void freeShader(std::string id);
	bool loadShader(std::string pathVert, std::string pathFrag);

	static shaderManager* instance();
	~shaderManager();
};

shaderManager* SM();

void loadShaderDirectory(const boost::filesystem::path & directory, bool recurse_into_subdirs);

#endif